<?php

Yii::import('application.modules.news.models.db.BaseKitNewsArticle');
class KitNewsArticle extends BaseKitNewsArticle
{
    var $className = __CLASS__;

    public static function model($className=__CLASS__)
    {
        return parent::model($className);
    }
    
    protected function beforeValidate() {
        if ($this->isNewRecord) {
            $this->creator = Yii::app()->user->id;
            $this->created = time();
            $this->active = 1;
            $this->recycle = 0;
        } else {
            $this->editor = Yii::app()->user->id;
            $this->edited = time();            
        }


        return parent::beforeValidate();
    }

    public function getStatusLink($model, $grid, $id, $status) {
        $imageIcon = letFunction::statusToImages($status);
        
        
        CHtml::link(letFunction::statusToImages($data->active), "", array(
            'onclick'=>'loadAjax("'.Yii::app()->createUrl('//global/ChangeStatusValue/index', array('model'=>'Languages', 'valueChange'=>$valueChange)).'", "", "'.$id.'")'
        ));
        
        

        echo '<a href="" onclick="">'.$imageIcon.'</a>';
    }
}